package com.wanmait.baohan.service.Impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.baohan.mapper.TravelLogMapper;
import com.wanmait.baohan.pojo.TravelLog;
import com.wanmait.baohan.service.TravelLogService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import javax.annotation.Resource; 
import java.util.List;

@Service
@Transactional(rollbackFor = Exception.class)
public class TravelLogServiceImpl  implements TravelLogService {
    @Resource
    private TravelLogMapper travelLogMapper;

    @Override
    public List<TravelLog> selectByTravelApplitionId(Integer id) {

        List<TravelLog> travelLogs = travelLogMapper.selectByTravelApplitionId(id);

        return travelLogs;
    }

    @Override
    public void saveTravelLog(TravelLog travelLog) {
        travelLogMapper.insertSelective(travelLog);
    }


    @Override
    public PageInfo<TravelLog> findDraftBoxBbyId(Integer page, Integer limit, Integer id)
    {
        PageHelper.startPage(page, limit);
        List<TravelLog> logs = travelLogMapper.findDraftBoxBbyId(id);
        PageInfo<TravelLog> travelLogPageInfo = new PageInfo<>(logs,8);
        return travelLogPageInfo;
    }


}
